//
//  HJDWeightGuideViewController.m
//  JYHospital
//
//  Created by 胡金东 on 16/6/15.
//  Copyright © 2016年 胡金东. All rights reserved.
//

#import "HJDWeightGuideViewController.h"

@interface HJDWeightGuideViewController ()

@end

@implementation HJDWeightGuideViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"体重指南";
    [self.navigationController.navigationBar setTitleTextAttributes:
     @{NSFontAttributeName:[UIFont systemFontOfSize:19],
       NSForegroundColorAttributeName:[UIColor getColorWithHexNumber:@"848484"]}];
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(popToPre) image:@"︿" HighImage:nil];
  
    [self setUpContent];
}
//返回
-(void)popToPre
{
    [self.navigationController popViewControllerAnimated:YES];;
}

-(void)setUpContent{
    
    UIView *viewB = [[UIView alloc]initWithFrame:CGRectMake(0, HJDNavigHeight , HJDWidth, 15)];
    viewB.backgroundColor = [UIColor getColorWithHexNumber:@"F1F0EE"];
    [self.view addSubview:viewB];
    
    UIImageView *iconImg = [[UIImageView alloc]initWithFrame:CGRectMake(HJDHorizontalMargin, CGRectGetMaxY(viewB.frame) + HJDVerticalMargin, 13/2, 13/2)];
    iconImg.image = [UIImage imageNamed:@"体重指南"];
    [self.view addSubview:iconImg];
    
    CGFloat lblContentX = CGRectGetMaxX(iconImg.frame)+3;
    CGFloat lblContentY = CGRectGetMaxY(viewB.frame) + 14;
    CGFloat lblContentW = HJDWidth - 28.5 -20;
    UILabel *lblContent = [[UILabel alloc]init];
    lblContent.text = @"体重指数BMI\nBMI<18.5，孕前体型偏瘦\n18.5≤BMI≤23.9\nBMI>23.9，孕前体型偏胖";
    lblContent.font = [UIFont systemFontOfSize:14];
    lblContent.textColor = [UIColor getColorWithHexNumber:@"616060"];
    lblContent.numberOfLines = 0;
    CGRect lblContentRect = [lblContent.text boundingRectWithSize:CGSizeMake(lblContentW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:lblContent.font,NSFontAttributeName, nil] context:nil];
    lblContent.frame = (CGRect){{lblContentX,lblContentY},lblContentRect.size};
    [self.view addSubview:lblContent];
    
    
    UIImageView *iconImgone = [[UIImageView alloc]initWithFrame:CGRectMake(HJDHorizontalMargin, CGRectGetMaxY(lblContent.frame) + HJDVerticalMargin, 13/2, 13/2)];
    iconImgone.image = [UIImage imageNamed:@"体重指南"];
    [self.view addSubview:iconImgone];

    CGFloat lblCX = CGRectGetMaxX(iconImgone.frame)+3;
    CGFloat lblCY = CGRectGetMaxY(lblContent.frame) + 14;
    CGFloat lblCW = HJDWidth - 28.5 -20;
    UILabel *lblC = [[UILabel alloc]init];
    lblC.text = @"孕前胖瘦度\n数值为负是偏瘦，数值为正式偏胖\n数值越接近0，体重越标准。\n数值超过20%要特别注意";
    lblC.font = [UIFont systemFontOfSize:14];
    lblC.textColor = [UIColor getColorWithHexNumber:@"616060"];
    lblC.numberOfLines = 0;
    CGRect lblCRect = [lblC.text boundingRectWithSize:CGSizeMake(lblCW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:lblC.font,NSFontAttributeName, nil] context:nil];
    lblC.frame = (CGRect){{lblCX,lblCY},lblCRect.size};
    [self.view addSubview:lblC];
    
    UIImageView *icon = [[UIImageView alloc]initWithFrame:CGRectMake(HJDHorizontalMargin, CGRectGetMaxY(lblC.frame) + HJDVerticalMargin, 13/2, 13/2)];
    icon.image = [UIImage imageNamed:@"体重指南"];
    [self.view addSubview:icon];
    
    CGFloat lblX = CGRectGetMaxX(icon.frame)+3;
    CGFloat lblY = CGRectGetMaxY(lblC.frame) + 14;
    CGFloat lblW = HJDWidth - 28.5 -20;
    UILabel *lbl = [[UILabel alloc]init];
    lbl.text = @"整个孕期的理想增重\n偏瘦型的准妈妈，整个孕期的理想增重为12-15kg。体型标准的准妈妈增长12 kg左右为宜。体型偏胖的准妈妈孕期增长7-10kg左右。\n\n孕妇体重增加的“速度”与“重量”一样重要。孕早期，体重应增加1-1.5kg；孕中期，每周增加0.25-0.35kg；孕晚期，每周增加0.5kg左右。\n\n要是在头3个月中体重增加不够的话，那么看看你是否患有失眠或厌食，如果其他都正常，那就不必为体重增加不足而担心。\n\n体型偏胖的准妈妈，在4-9个月时，体重增长要有所控制，以接近理想增长为佳。如果怀疑体重增长异常，应以医生的建议为准。";
    lbl.font = [UIFont systemFontOfSize:14];
    lbl.textColor = [UIColor getColorWithHexNumber:@"616060"];
    lbl.numberOfLines = 0;
    CGRect lblRect = [lbl.text boundingRectWithSize:CGSizeMake(lblW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:lbl.font,NSFontAttributeName, nil] context:nil];
    lbl.frame = (CGRect){{lblX,lblY},lblRect.size};
    [self.view addSubview:lbl];

    
}

@end
